package com.etcn.modules.busi.home.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import com.etcn.common.annotation.QueryCache;
import com.etcn.common.service.impl.CrudServiceImpl;
import com.etcn.common.utils.StringUtil;
import com.etcn.modules.busi.home.dao.IWmNoticeDao;
import com.etcn.modules.busi.home.pojo.WmNotice;
import com.etcn.modules.busi.home.service.IWmNoticeService;

/**
 * 公告serviceImpl
 * 
 * @author guozc
 * @date 2018-01-30 22:44:55
 */
@Service("wmNoticeService")
public class WmNoticeServiceImpl extends CrudServiceImpl<IWmNoticeDao, WmNotice> implements IWmNoticeService {

	@Value("${image.down.url}")
	private String imageDownUrl;
	
	@QueryCache(keyPrefix="notices")
	@Override
	public List<WmNotice> findAppList(WmNotice entity) throws Exception {
		List<WmNotice> notices = super.findAppList(entity);
		if(notices != null){
			for(WmNotice notice : notices){
				if(StringUtil.isNotEmpty(notice.getContent())){
					notice.setContent(notice.getContent().replace("/userfiles", imageDownUrl+"userfiles/"));
				}
			}
		}
		return notices;
	}
}